symbol dtr_status = b1
symbol hold_time = b2
dtr_status = 1

REM cts high, disable rs232 tx data flow until modem steup complete
high 6
REM Rx modem low disable tone
low 5
REM radio ptt line high, keep in Rx mode
high 3
REM delay for 100ms to allow modem circuits to settle down
pause 100


top:
readadc 1,b0
REM give variable the ADC value, adc voltage limited 0.7V across diode reference
REM at adc = 0.7Volt(adc = 70) max * 2 multiplier, equals to max 140ms delay subroutine
REM max number for variable "hold_time" = 255
REM max hold_time 3 = 420ms
hold_time = b0 * 2
REM dtr = pin4 low = rs232 data tx ready
if pin4 = 0 then goto hold_open
REM dtr = pin4 high = rs232 data sent
if pin4 = 1 then goto hold_close
goto top


hold_open:
if dtr_stauts = 0 then goto top
REM Tx radio ptt line low
low 3
pause hold_time
pause hold_time
pause hold_time
REM modem ptt line high for analogue switch chip
high 5
pause hold_time
pause hold_time
pause hold_time
REM cts line low to allow rs232 tx data flow
low 6
dtr_status = 0
goto top

hold_close:
if dtr_status = 1 then goto top
REM cts line high, disable further rs232 tx data flow untill ready for new batch
high 6
pause hold_time
pause hold_time
pause hold_time
REM Rx modem ptt line low for analogue switch chip
low 5
pause hold_time
pause hold_time
pause hold_time
REM RX mode radio ptt line high
high 3
dtr_status = 1
goto top